﻿using System;
using System.Collections.Generic;
using System.Text;
using UnzipWizard;
using System.IO;

namespace WindowsSevicerTest
{
    public class UnzipAndDeleted : UnzipWizard.UnzipHelper
    {
        public override void unzipTo(string fromPath, string toPath)
        {
            if (!File.Exists(fromPath.Substring(0,fromPath.Length-4)+".csv"))
            {
                base.unzipTo(fromPath, toPath);
                Console.WriteLine("Unzip Finished");
                File.Delete(fromPath);
                Console.WriteLine("Zip file deleted");
            }
            else
            {
                File.Delete(fromPath.Substring(0, fromPath.Length - 4) + ".csv");
                unzipTo(fromPath, toPath);
            }


        }
    }
}
